
using System;
using System.Collections;
using System.Web.UI.WebControls;

using Awaken.Framework;
using Nullables;

namespace Pubs.Domain.Entities
{
    public partial class Publisher : IEntity
    {
        protected static PublisherBroker broker;
        public static PublisherBroker Broker
        {
            get
            {
                if (broker == null)
                {
                    broker = new PublisherBroker();
                }
                return broker;
            }
        }

        #region IEntity Members

        public string EntityID
        {
            get { return string.Empty; }
        }
        
        public string EntityName
        {
            get { return string.Empty; }
        }

        public void Save()
        {
            Broker.Save(this);
        }
        
        public void Delete()
        {
            Broker.Delete(this);
        }
        
        #endregion
    
        #region Constructor
        
        public Publisher()
        {
            // Default, no arg constructor.
        }
        
        #endregion
            
        #region Public Properties / Protected Fields
                        
        
        protected string _PubId;
        public string PubId
        {
            get{ return _PubId; }
            set{ _PubId=value; }
        }
        
        protected string _PubName;
        public string PubName
        {
            get{ return _PubName; }
            set{ _PubName=value; }
        }
        
        protected string _City;
        public string City
        {
            get{ return _City; }
            set{ _City=value; }
        }
        
        protected string _State;
        public string State
        {
            get{ return _State; }
            set{ _State=value; }
        }
        
        protected string _Country;
        public string Country
        {
            get{ return _Country; }
            set{ _Country=value; }
        }
        
        
        
        // One-To-Many: employee.pub_id  
        protected IList _EmployeeList;
        public IList EmployeeList
        {
            get{ return _EmployeeList; }
            set{ _EmployeeList=value; }
        }
        
        // One-To-Many: titles.pub_id  
        protected IList _TitleList;
        public IList TitleList
        {
            get{ return _TitleList; }
            set{ _TitleList=value; }
        }
        
        
                
        
        
        
        #endregion
    }
    
    #region PublisherBroker

    public partial class PublisherBroker : IBroker
    {
        #region IBroker Members

        public Type EntityType
        {
            get { return typeof(Publisher); }
        }
        
        public Publisher GetByID(object id)
        {
            return (Publisher)Awaken.Framework.Gateway.GetByID(EntityType, id);
        }

        public IList GetAll()
        {
            return Awaken.Framework.Gateway.GetAll(EntityType);
        }

        public void Save(IEntity entity)
        {
            Awaken.Framework.Gateway.Save(entity);
        }
        
        public void Delete(IEntity entity)
        {
            Awaken.Framework.Gateway.Delete(entity);
        }
        
        #endregion
    }
    #endregion
}
